:root {
    --primary-color: #4361ee;
    --secondary-color: #3f37c9;
    --accent-color: #4895ef;
    --light-color: #f8f9fa;
    --dark-color: #212529;
    --sidebar-width: 260px;
    --sidebar-collapsed-width: 80px;
    --header-height: 60px;
    --transition-speed: 0.3s;
    --border-radius: 8px;
    --shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    --card-bg: #ffffff;
    --text-color: #333333;
    --sidebar-bg: #2c3e50;
    --sidebar-text: #ecf0f1;
    --sidebar-hover: #34495e;
    --window-btn-hover: rgba(0, 0, 0, 0.1);
    --close-btn-hover: #e74c3c;
}

.dark-theme {
    --light-color: #121212;
    --dark-color: #f8f9fa;
    --card-bg: #1e1e1e;
    --text-color: #e0e0e0;
    --sidebar-bg: #1a1a2e;
    --sidebar-text: #bbbbbb;
    --sidebar-hover: #16213e;
    --window-btn-hover: rgba(255, 255, 255, 0.1);
    --close-btn-hover: #c0392b;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

body {
    background-color: var(--light-color);
    color: var(--text-color);
    transition: background-color var(--transition-speed);
    overflow: hidden;
    height: 100vh;
}

.app-container {
    display: flex;
    height: 100vh;
    transition: all var(--transition-speed);
}

/* 侧边栏样式 */
.sidebar {
    width: var(--sidebar-width);
    background: var(--sidebar-bg);
    color: var(--sidebar-text);
    height: 100%;
    overflow-y: auto;
    transition: width var(--transition-speed);
    z-index: 100;
    box-shadow: var(--shadow);
    app-region: drag; /* 可拖动 */
}

.sidebar.collapsed {
    width: var(--sidebar-collapsed-width);
}

.sidebar-header {
    padding: 20px 15px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    height: var(--header-height);
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.5rem;
    font-weight: bold;
    white-space: nowrap;
    overflow: hidden;
}

.logo i {
    font-size: 1.8rem;
    color: var(--accent-color);
}

.logo-text {
    transition: opacity var(--transition-speed);
}

.sidebar.collapsed .logo-text {
    opacity: 0;
    width: 0;
}

.toggle-btn {
    background: none;
    border: none;
    color: var(--sidebar-text);
    font-size: 1.2rem;
    cursor: pointer;
    transition: transform var(--transition-speed);
    app-region: no-drag; /* 不可拖动 */
}

.sidebar.collapsed .toggle-btn {
    transform: rotate(180deg);
}

.nav-links {
    list-style: none;
    padding: 15px 0;
    app-region: no-drag; /* 不可拖动 */
}

.nav-item {
    margin: 5px 10px;
    border-radius: var(--border-radius);
    overflow: hidden;
}

.nav-link {
    display: flex;
    align-items: center;
    padding: 12px 15px;
    color: var(--sidebar-text);
    text-decoration: none;
    transition: all 0.2s;
    gap: 15px;
}

.nav-link:hover {
    background: var(--sidebar-hover);
}

.nav-link.active {
    background: var(--primary-color);
    color: white;
}

.nav-link i {
    font-size: 1.2rem;
    min-width: 24px;
    text-align: center;
}

.nav-text {
    transition: opacity var(--transition-speed);
    white-space: nowrap;
}

.sidebar.collapsed .nav-text {
    opacity: 0;
    width: 0;
}

/* 主内容区域 */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.header {
    height: var(--header-height);
    background: var(--card-bg);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    box-shadow: var(--shadow);
    z-index: 10;
    app-region: drag; /* 可拖动 */
}

.page-title {
    font-size: 1.5rem;
    font-weight: 600;
}

.header-actions {
    display: flex;
    gap: 15px;
    align-items: center;
    app-region: no-drag; /* 不可拖动 */
}

.theme-toggle {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: none;
    border: none;
    font-size: 1.2rem;
    color: var(--text-color);
    cursor: pointer;
}

.theme-toggle:hover {
    background: var(--window-btn-hover);
}

.user-menu {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    padding: 5px 10px;
    border-radius: 20px;
    transition: background 0.2s;
}

.user-menu:hover {
    background: var(--window-btn-hover);
}

.user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--primary-color);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: bold;
}

.content-area {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    background-color: rgba(0, 0, 0, 0.03);
}

.page {
    display: none;
}

.page.active {
    display: block;
    animation: fadeIn 0.5s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.card {
    background: var(--card-bg);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    padding: 20px;
    margin-bottom: 20px;
    transition: transform 0.2s;
}

.card:hover {
    transform: translateY(-3px);
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
}

.card-title {
    font-size: 1.2rem;
    font-weight: 600;
}

.card-content {
    line-height: 1.6;
}

.stats-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    background: var(--card-bg);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 15px;
}

.stat-icon {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: var(--primary-color);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.5rem;
}

.stat-info {
    flex: 1;
}

.stat-value {
    font-size: 1.8rem;
    font-weight: bold;
    margin-bottom: 5px;
}

.stat-label {
    color: #777;
    font-size: 0.9rem;
}

.window-controls {
    display: flex;
    align-items: center;
    gap: 8px;
}

.window-btn {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-color);
    transition: all 0.2s ease;
    font-size: 0.9rem;
}

.window-btn:hover {
    background: var(--window-btn-hover);
}

.close-btn:hover {
    background: var(--close-btn-hover);
    color: white;
}

/* 响应式设计 */
@media (max-width: 992px) {
    .sidebar {
        position: absolute;
        left: 0;
        height: 100%;
    }

    .sidebar.collapsed {
        transform: translateX(-100%);
    }

    .main-content {
        margin-left: 0;
    }
}

@media (max-width: 576px) {
    .stats-container {
        grid-template-columns: 1fr;
    }

    .header {
        padding: 0 10px;
    }

    .user-name {
        display: none;
    }

    .window-controls {
        gap: 5px;
    }

    .window-btn {
        width: 28px;
        height: 28px;
        font-size: 0.8rem;
    }

    .page-title {
        font-size: 1.2rem;
    }
}
